package com.nh.handler;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * @classDesc: 功能描述：(捕获全局异常)
 * @author: 王杰
 * @createTime: 2017年11月04日  21:19
 * @version: V1.0
 */
@ControllerAdvice
public class BlobalExceptionHandler {

    @ExceptionHandler(RuntimeException.class)
    @ResponseBody
    public Map<String,Object> exceptionHandler(){
        HashMap<String, Object> map = new HashMap<>();
        map.put("code", "500");
        map.put("msg", "系统错误111，请刷新重试1");
        return map;
    }
}
